//
//  TakeInfoPlist.m
//  CarService
//
//  Created by Nimo.Yu on 15/1/30.
//  Copyright (c) 2015年 lexingsoft. All rights reserved.
//

#import "TakeInfoPlist.h"
#import <sys/utsname.h>
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
#import <CoreTelephony/CTCarrier.h>

@interface TakeInfoPlist ()
+(NSDictionary *)infoPlistDic;
@end
@implementation TakeInfoPlist

+ (NSDictionary *)infoPlistDic{
    return [[NSBundle mainBundle] infoDictionary];
}

/// 开发语言环境
+ (NSString *)CFBundle_DevelopmentRegion
{
    return [[TakeInfoPlist infoPlistDic] objectForKey:@"CFBundleDevelopmentRegion"];
}

/// 应用程序展示的名称
+ (NSString *)CFBundle_DisplayName
{
    return [[TakeInfoPlist infoPlistDic] objectForKey:@"CFBundleDisplayName"];
}

///
+ (NSString *)CFBundle_Executable
{
    return [[TakeInfoPlist infoPlistDic] objectForKey:@"CFBundleExecutable"];
}

/// BundleId
+ (NSString *)CFBundle_Identifier
{
    return [[TakeInfoPlist infoPlistDic] objectForKey:@"CFBundleIdentifier"];
}

///
+ (NSString *)CFBundle_InfoDictionaryVersion
{
    return [[TakeInfoPlist infoPlistDic] objectForKey:@"CFBundleInfoDictionaryVersion"];
}

/// infoPlist路径
+ (NSString *)CFBundle_InfoPlistURL
{
    return [[TakeInfoPlist infoPlistDic] objectForKey:@"CFBundleInfoPlistURL"];
}

/// 产品名称
+ (NSString *)CFBundle_Name
{
    return [[TakeInfoPlist infoPlistDic] objectForKey:@"CFBundleName"];
}

///
+ (NSString *)CFBundle_NumericVersion
{
    return [[TakeInfoPlist infoPlistDic] objectForKey:@"CFBundleNumericVersion"];
}

/// package type
+ (NSString *)CFBundle_PackageType
{
    return [[TakeInfoPlist infoPlistDic] objectForKey:@"CFBundlePackageType"];
}

/// shortVersion
+ (NSString *)CFBundle_ShortVersionString
{
    return [[TakeInfoPlist infoPlistDic] objectForKey:@"CFBundleShortVersionString"];
}

/// 签名
+ (NSString *)CFBundle_Signature
{
    return [[TakeInfoPlist infoPlistDic] objectForKey:@"CFBundleSignature"];
}

/// 应用版本
+ (NSString *)CFBundle_Version
{
    return [[TakeInfoPlist infoPlistDic] objectForKey:@"CFBundleVersion"];
}

+ (NSString *)DTCompiler
{
    return [[TakeInfoPlist infoPlistDic] objectForKey:@"DTCompiler"];
}

+ (NSString *)DTPlatformName
{
    return [[TakeInfoPlist infoPlistDic] objectForKey:@"DTPlatformName"];
}

+(NSString *)deviceIdentifierCValue{
    NSString *temp=[TakeInfoPlist deviceIdentifier];
    temp=[temp stringByReplacingOccurrencesOfString:@"-" withString:@""];
    temp=[temp lowercaseString];
    return temp;
}

+(NSString *)deviceIdentifier
{
    return [[UIDevice currentDevice] identifierForVendor].UUIDString;
}

+ (NSString*)machineName
{
    struct utsname systemInfo;
    uname(&systemInfo);
    
    return [NSString stringWithCString:systemInfo.machine
                              encoding:NSUTF8StringEncoding];
}

+ (NSString *)carrierName
{
    CTTelephonyNetworkInfo *netInfo = [[CTTelephonyNetworkInfo alloc] init];
    CTCarrier *carrier = [netInfo subscriberCellularProvider];
    NSString *tempCarrierName = [carrier carrierName];
    if (tempCarrierName == nil) {
        tempCarrierName = @"模拟器";
    }
    return tempCarrierName;
}

@end
